
from typing import List
from ..model.student_model import Student
from ..repository.mysql_repository import MySQLStudentRepository

class StudentService:
    def __init__(self, student_repository: MySQLStudentRepository):
        self.student_repository = student_repository

    async def get_all_students(self) -> List[Student]:
        """获取所有学生信息"""
        students_data = await self.student_repository.get_all_students()
        # 将字典列表转换为Student对象列表
        return [Student(**student) for student in students_data]
